

#define MXP_BEGIN 	'\x03'	// becomes <
#define MXP_END		'\x04'	// becomes >
#define MXP_AMP		'\x05'	// becomes &

// Use MXPTAG(ARG) like: MXPTAG(
#define MXPTAG(ARG) MXP_BEGIN ARG MXP_END

enum class MXPTag
{
	Open, Secure, Locked, Reset, TempSecure,
	LockOpen, LockSecure, LockLocked,

	RoomName = 10, RoomDesc, RoomExit, Welcome,

	UserDefined1 = 20,

	UserDefined79 = 99
};

// TODO this needs fixed as it stands
#define ESC			'\x1b'
#define MXPMODE(tag) 	(ESC "[" #tag "z")

// The MXP preamble is our send-once-at-login list of tags that we want to
// setup in the client.





enum class Colorable
{
	plain, action, say, yell, tell, hit, hitme, immortal, hurt, magic,
	consider, report, poison, social, dying, dead, skill, damage, person,
	npc, bye, gold, note, exit, pvp, who, racetalk, whisper, shout,
	intermud, board,

	max
};

// Used for context-sensitive menu show list
enum class mxpItem {
	Nothing, Get, Drop, Bid
};

namespace mxp
{
char *	emit_expire(const std::string & t)
{
	std::ostringstream ss;
	ss << "<EXPIRE " << t << ">" << std::endl;
	return (ss.str().data());
}

char *	emit_version()
{
	return "<VERSION>";
}

char *	emit_support()
{
	return "<SUPPORT>";
}

char * emit_bold(const std::string & s) {
	std::ostringstream ss;
	ss << "<B>" << s << "<?B>" << std::endl;
	return ss.str().data();
}

char *	emit_italic(const std::string & s)
{
	std::ostringstream ss;
	ss << "<I>" << s << "</I>" << std::endl;
	return ss.str().data();
}

char * emit_underline(const std::string & s)
{
	std::ostringstream ss;
	ss << "<U>" << s << "</U>" << std::endl;
	return ss.str().data();
}

char *	emit_strikeout(const std::string & s)
{
	std::ostringstream ss;
	ss << "<S>" << s << "</S>" << std::endl;
	return ss.str().data();
}

char *	emit_high(const std::string & s)
{
	std::ostringstream ss;
	ss << "<H>" << s << "</H>" << std::endl;
	return ss.str().data();
}

char *	emit_colorln(const std::string & s, const std::string & c)
{
	std::ostringstream ss;
	ss << "<C " << c << ">" << s << "</C>" << std::endl;
	return ss.str().data();
}

char *	emit_br() { return "<BR>"; }

// next has some special behavior
// any newlines or carriage feeds in the strings of lines between
// <P></P> are converted into a space in the output.
char *	emit_p(std::string & s)
{
	// any \n or \r replaced by ' '
	const char * ws = "\n\r";
	size_t found = s.find_first_of(ws);
	while(found != std::string::npos)
	{
		s[found] = ' ';
		found = s.find_first_of(ws);
	}

	std::ostringstream ss;
	ss << "<P>" << s << "</P>" << std::endl;
	return ss.str().data();
}

// I don't think MUSHclient supports the following tags anyway...
char * emit_h1(const std::string & s)
{
	std::ostringstream ss;
	ss << "<H1>" << s << "</H1>" << std::endl;
	return ss.str().data();
}
char * emit_h2(const std::string & s)
{
	std::ostringstream ss;
	ss << "<H2>" << s << "</H2>" << std::endl;
	return ss.str().data();
}
char * emit_h3(const std::string & s)
{
	std::ostringstream ss;
	ss << "<H3>" << s << "</H3>" << std::endl;
	return ss.str().data();
}
char * emit_h4(const std::string & s)
{
	std::ostringstream ss;
	ss << "<H4>" << s << "</H4>" << std::endl;
	return ss.str().data();
}

// this


}
